package com.bruce.demo2.patterns.demo2.structural.demo08.decorator;

/**
 * @PROJECT_NAME: design_patterns
 * @DESCRIPTION: 测试类
 * @AUTHOR: CNBruceLee
 * @DATE: 2021/7/25 21:36
 */
public class Test {
    @org.junit.Test
    public void test() {
        //点一份拉面
        Noodles noodles = new Noodles();
        //花费的价格
        System.out.println(noodles.getDesc() + " " + noodles.cost() + "元");
        System.out.println("============================");

        //在拉面的基础上加鸡蛋
        Egg egg = new Egg(noodles);
        //花费的价格
        System.out.println(egg.getDesc() + " " + egg.cost() + "元");
        System.out.println("============================");

        //在上面的基础上再加牛肉
        Beef beef = new Beef(egg);
        //花费的价格
        System.out.println(beef.getDesc() + " " + beef.cost() + "元");
        System.out.println("============================");

        //再加一个鸡蛋
        Egg egg2 = new Egg(beef);
        //花费的价格
        System.out.println(egg2.getDesc() + " " + egg2.cost() + "元");


    }
}
